package com.zxy.broker.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zxy.broker.entity.HousesTypeEntity;
import com.zxy.broker.service.HousesTypeService;
import com.zxy.common.utils.PageUtils;
import com.zxy.common.utils.R;



/**
 * 楼盘类型表(可维护)
 *
 * @author axy
 * @email sunlightcs@gmail.com
 * @date 2022-04-27 18:48:49
 */
@RestController
@RequestMapping("broker/housestype")
@CrossOrigin
public class HousesTypeController {
    @Autowired
    private HousesTypeService housesTypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = housesTypeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{housesTypeId}")

    public R info(@PathVariable("housesTypeId") Integer housesTypeId){
		HousesTypeEntity housesType = housesTypeService.getById(housesTypeId);

        return R.ok().put("housesType", housesType);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody HousesTypeEntity housesType){
		housesTypeService.save(housesType);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody HousesTypeEntity housesType){
		housesTypeService.updateById(housesType);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] housesTypeIds){
		housesTypeService.removeByIds(Arrays.asList(housesTypeIds));

        return R.ok();
    }

}
